package com.ext.aic.apis.user;

import android.content.Context;

import androidx.lifecycle.LifecycleOwner;

import com.ext.aic.apis.ApiDefine;
import com.ext.aic.apis.ApiPaths;
import com.ext.aic.apis.RequestResponse;
import com.ext.aic.beans.response.UserInfoResponse;
import com.hjq.http.EasyHttp;

public class UserInfoRequest {

    public void onRequestUserInfoSuccess(UserInfoResponse response) {

    }

    public void request(Context context, LifecycleOwner lifecycleOwner) {
        EasyHttp.get(lifecycleOwner)
                .api(new ApiDefine(ApiPaths.userInfo))
                .request(new RequestResponse<UserInfoResponse>(context, true) {
                    @Override
                    protected void onSuccess(UserInfoResponse response) {
                        if (response == null) {
                            return;
                        }
                        onRequestUserInfoSuccess(response);
                    }
                });

    }
}
